package com.totem.product.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.jetbrains.annotations.NotNull;

import java.io.Serializable;
import java.util.List;

@Data
public class ProductVO implements Comparable<ProductVO>, Serializable {
    private Long productId;
    private String productName;
    private String introductory;
    @Schema(description = "卖家昵称(商品发布人)")
    private String createByNickname;
    @Schema(description = "商品图片url")
    private ProductUrlVO productUrlVO;
    @Schema(description = "未售罄规格中最早的一个")
    private ProductSpecVO latestProductSpecVO;
    @Schema(description = "所有规格")
    private List<ProductSpecVO> productSpecVOList;
    @Schema(description = "商品详细配置")
    private ProductDetailVO productDetailVO;
    @Schema(description = "库存, 销量=库存-可用-冻结")
    private ProductInvVO productInvVO;
    @Schema(description = "商品创建时间")
    private String createAt;
    @Schema(description = "收藏状态", example = "当前用户是否收藏,true,false")
    private Boolean favoriteState;

    @Override
    public int compareTo(@NotNull ProductVO o) {
        return o.getCreateAt().compareTo(this.getCreateAt());
    }
}
